package gafinal;

import java.util.List;

import javax.swing.table.AbstractTableModel;

public class LoadsTableModel extends AbstractTableModel {

	private static int columnCount = 16;
	private static int rowCount = 4;
	
	private List<Integer> loads;
	private FitnessLogEvaluator loadDistributionEvaluator = new FitnessLogEvaluator();
	public LoadsTableModel() {
	}

	public void setLoads(List<Integer> loads) {
		this.loads = loads;
		fireTableRowsUpdated(0, getRowCount() - 1);
	}

	public List<Integer> getLoads() {
		return this.loads;
	}

	@Override
	public int getColumnCount() {
		return columnCount;
	}

	@Override
	public int getRowCount() {
		return rowCount;
	}

	@Override
	public Object getValueAt(int rowIndex, int colIndex) {
		if (loads == null)
			return 0;
		return LoadsWeight.getWeight(loads.get(colIndex*rowCount + rowIndex));
	}

}
